Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add perform_celltyping parameter #506

Merged
merged 6 commits into from
Oct 16, 2023

Conversation

allyhawkins
Copy link
Member

@allyhawkins allyhawkins commented Oct 12, 2023

Closes #494
Stacked on #503

Here I'm adding in the flag to specify whether or not we want to run the cell typing part of the workflow with --perform_celltyping. As we discussed, this is set to false by default. This means to annotate cell types when running the workflow, you need to use the flag.

There wasn't really anything too involved here since the output of annotate_celltypes already matches the output of cluster_sce.
I tested this with the stub workflow both with and without --perform_celltyping and the expected processes were skipped when the flag was absent. I'm doing a test run with an actual library just to be sure everything is good.
Edit: The tests finished so flag works as expected!

@allyhawkins allyhawkins requested a review from jashapiro October 12, 2023 22:05
@jashapiro
Copy link
Member

A couple more things to do with this PR, based on things that happened last week:

// TODO: add `params.perform_celltyping && (...)` when implemented
has_celltypes = (meta.submitter_cell_types_file || meta.singler_model_file || meta.cellassign_reference_file)

and:

// TODO: add `params.perform_celltyping && (...)` when implemented
has_celltypes = meta.submitter_cell_types_file || meta.singler_model_file || meta.cellassign_reference_file

We just want to skip the supplemental report if we don't do cell typing. Though maybe we want to keep it if there are submitter cell types? I'm sort of rethinking what the exact logic should be, but skipping the extended report seems reasonable enough.

@allyhawkins
Copy link
Member Author

Sorry I totally missed those things. I'll add them in and then re-request review.

We just want to skip the supplemental report if we don't do cell typing. Though maybe we want to keep it if there are submitter cell types? I'm sort of rethinking what the exact logic should be, but skipping the extended report seems reasonable enough.

I think definitely skipping the extended report, but I actually think keeping the cell typing with just submitter annotations is a good idea. To me, that's being added in separate from the SingleR and CellAssign cell types, so I think we want to be able to show those even if we didn't do the other methods.

@allyhawkins
Copy link
Member Author

Okay I added in some logic to make sure that the main section of the cell type report is there if submitter annotations are there, regardless of if other cell type methods have been performed or not. Then, the supplemental report is only there if the --perform_celltyping is used and either CellAssign or SingleR has been run.

Here's an example of a report with submitter cell types, but no other cell types.
SCPCL000495_qc.html.zip

Copy link
Member

@jashapiro jashapiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, but I had a couple minor formatting suggestions (assuming they work as I feel like they should).

modules/qc-report.nf Outdated Show resolved Hide resolved
Comment on lines 176 to 182
```{r, eval = has_singler | has_cellassign}
knitr::asis_output(
glue::glue("
For additional information about cell typing, including diagnostic plots and/or heatmap comparisons among annotations (if available), please refer to the [supplementary cell type QC report](`r params$celltype_report`).
")
)
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason we are wrapping here and above rather than using the chunk options? I think knitr::asis_output() is useful if we have a mix of outputs, but kind of distracting if the entire chunk is asis

Suggested change
```{r, eval = has_singler | has_cellassign}
knitr::asis_output(
glue::glue("
For additional information about cell typing, including diagnostic plots and/or heatmap comparisons among annotations (if available), please refer to the [supplementary cell type QC report](`r params$celltype_report`).
")
)
```
````{r, eval = has_singler | has_cellassign, result = 'asis'}
glue::glue("
For additional information about cell typing, including diagnostic plots and/or heatmap comparisons among annotations (if available), please refer to the [supplementary cell type QC report](`r params$celltype_report`).
")

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, the only reason I did it this way was to mirror how the other sections were. But we can change to using result='asis' throughout instead of knitr::asis_output?

modules/qc-report.nf Outdated Show resolved Hide resolved
Base automatically changed from allyhawkins/celltypes-to-sce to development October 13, 2023 15:59
@allyhawkins
Copy link
Member Author

Just noting that I decided to switch all the chunks that were just text to use results='asis' rather than knitr::asis_output and rendered the report to test that things still looked as expected. Going to go ahead and merge this.

@allyhawkins allyhawkins merged commit 8745910 into development Oct 16, 2023
3 checks passed
@allyhawkins allyhawkins deleted the allyhawkins/perform-celltyping branch October 16, 2023 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants